﻿using System;
using System.Threading;
using EzDesk.DesktopClient.Event;
using EzDesk.Generic;

namespace EzDesk.DesktopClient
{
    public class TodoManagement : ManagementBase<TodoManagement>
    {
        private const string AddTodoUrlBase = "/project/workitemlist#create";

        public void SetCurrentTodoStatus(string id)
        {
            ThreadPool.QueueUserWorkItem(obj =>
            {
                try
                {
                    CoreClientService.SetUserStatus(CurrentUser.Id, Guid.Parse(id));
                }
                catch (Exception ex)
                {
                    LogEx.TRACE("TodoManagment", ex.Message);
                }
            });
        }

        public void AddTodo()
        {
            FunctionNavigateEvent.Instance.Publish(new FunctionNavigateArgs
                {
                    Url = ServiceBaseUrl + AddTodoUrlBase
                });
        }

    }
}